<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
    <title>系统登录</title>
    <link href="/public/plugins/bootstrap/css/bootstrap.min.css" rel="stylesheet">
    <link href="/public/plugins/fontawesome/css/font-awesome.css?v=4.4.0" rel="stylesheet">
    <link href="/public/plugins/animate/animate.css" rel="stylesheet">
    <link href="/public/system/css/style.css" rel="stylesheet">
    <link href="/public/system/css/login.css" rel="stylesheet">
    <!--[if lt IE 9]>
    <meta http-equiv="refresh" content="0;ie.html"/>
    <![endif]-->
    <script>
        if (window.top !== window.self) {
            window.top.location = window.location;
        }
    </script>
    <style>
        body{background:url('/public/system/img/login_bg_02.png') repeat;height:100%;}
        li{list-style:none;}
        .signbox{width:100%;height:100%;background:url('/public/system/img/login_bg_02_pic_1.png') no-repeat center center;}
        .signbox .loginbox{width:400px;height:350px;position:absolute;top:50%;left:50%;margin:-170px 0 0 -200px;border-radius:10px;}
        .signbox .loginbox .login-menu{width:400px;height:60px;background:url('/public/system/img/login_bg_02.png') repeat;}
        .signbox .loginbox .login-menu .item{width:190px;height:52px;float:left;border-radius:0 10px 0 0;text-align:center;background:#31acb6;margin-top:8px;position:relative;}
        .signbox .loginbox .login-menu .item a{display:block;width:100%;height:52px;line-height:52px;font-size:16px;color:#fff;}
        .signbox .loginbox .login-menu .active{width:200px;height:60px;background:#fff;margin-top:0;padding-top:8px;line-height:52px;font-size:16px;color:#333;border-radius:10px 10px 0 0; }
        .signbox .loginbox .login-form{width:400px;height:290px;background:#fff;padding:40px;border-radius:0 10px 10px 10px; }
        #triangle-bottomleft {position:absolute;  left:0;top:0;  width: 0;  height: 0;  border-bottom: 52px solid #258188;  border-right: 8px solid transparent;  }
        #loginForm input{margin-bottom:20px;}
    </style>
</head>
<body>
<div class="signbox">
    <div class="loginbox">
        <div class="login-menu">
            <div class="item active">店铺创始人登录</div>
        </div>
        <div class="login-form">
            <form method="post" id="loginForm">
                <input type="hidden" id="utype" name="utype" class="form-control" value="site" />
                <input type="text" id="account" name="account" class="form-control input-lg" placeholder="请输入帐户"/>
                <input type="password" id="password" name="password" class="form-control input-lg" placeholder="请输入密码"/>
                <button type="button" class="btn btn-success btn-block btn-lg" id="btnLogin">登录</button>
                <p style="color:#989898;padding:15px;text-align:center;line-height:24px;">
                    &copy; 2016 All Rights Reserved. 多用户商城系统
                </p>
            </form>
        </div>
    </div>
</div>
<!-- 全局js -->
<script src="/public/plugins/jquery.min.js?v=2.1.4"></script>
<script src="/public/plugins/bootstrap/js/bootstrap.min.js?v=3.3.6"></script>
<script src="/public/plugins/layer/layer.js"></script>
<!--自定义js-->
<!--公共js-->
<script src="/public/system/js/common.js"></script>
<script type="text/javascript">
    $(document).ready(function () {
        $(function () {
            $('#btnLogin').bind('click', function () {
                doLogin();
            });
            document.onkeydown = function (e) {
                var ev = document.all ? window.event : e;
                if (ev.keyCode == 13) {
                    doLogin();
                }
            }
        });
    });
    //用户登录
    function doLogin(){
        var account = $('#account').val();
        var password = $('#password').val();
        if (account == '') {
            layer.alert('帐户不能为空！', {icon: 2});
            return false;
        }
        if (password == '') {
            layer.alert('密码不能为空！', {icon: 2});
            return false;
        }
        var url = "{:url('doLogin')}";
        $.ajax({
            type: 'post',
            url: url,
            data: $('#loginForm').serialize(),
            cache: false,
            async: false,
            beforeSend: function (data) {
                layer.load();
            },
            success: function (data) {
                layer.closeAll();
                if (data.code == 1) {
                    layer.msg(data.msg, {icon: 1, time: 1000, shade: 0.3}, function (index) {
                        layer.close(index);
                        location.href = data.url;
                    });
                } else {
                    layer.alert(data.msg, {icon: 2});
                }
            },
            error: function () {
                layer.closeAll();
                layer.alert('与服务器断开连接！', {icon: 2});
                return false;
            }
        });
    }
</script>
</body>
</html>